package com.lbg.drug.service.impl;

import cn.hutool.core.util.PageUtil;
import com.lbg.drug.commont.untils.PageUtils;
import com.lbg.drug.dto.StaPage;
import com.lbg.drug.entity.Statistic;
import com.lbg.drug.mapper.StatisticMapper;
import com.lbg.drug.service.StatisticService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lbg
 * @since 2022-04-26
 */
@Service
public class StatisticServiceImpl implements StatisticService {

    @Autowired
    private StatisticMapper statisticMapper;



    @Override
    public PageUtils  getAll(StaPage staPage) {
        staPage.setCurrIndex((staPage.getPageNo()-1)*staPage.getPageSize());
        staPage.setEndIndex(staPage.getPageSize());

        PageUtils pageUtils = new PageUtils(statisticMapper.selectAll(staPage),statisticMapper.getCount());


        return pageUtils;
    }
}
